package org.apache.struts2.plugin.json.writer;

import java.io.IOException;
import java.io.OutputStream;
import org.apache.struts2.plugin.json.Token;
import org.apache.struts2.plugin.json.model.JSONBoolean;

/**
 * @author VERDOÏA Laurent <verdoialaurent@gmail.com>
 */
public class JSONBooleanWriter extends AbstractJSONWriter<JSONBoolean> {

    public JSONBooleanWriter(JSONBoolean content, OutputStream out) {
        super(content, out);
    }

    @Override
    public void writeContent() throws IOException {
        if (content.getData() == true) {
            out.write(Token.TRUE.getBytes());
        } else {
            out.write(Token.FALSE.getBytes());
        }
    }
}
